<?php 
	include_once("BeanUsuario.php");
	include_once("ConnectionDB.php");

	class DAOUser extends ConnectionDB{

		private $oUsuario;
		
		public function _construct(){
			parent::__construct();
		}
		
		public function existUser($sUser){
			$this->oUsuario = new BeanUsuario;
			$this->sQuery = "SELECT login,tipo_usuario FROM usuarios WHERE login = '$sUser'";
			$bExist = false;
					
			$oResult = mysql_query($this->sQuery);
			
			if($oResult && mysql_num_rows($oResult)>0){
				$aRow = mysql_fetch_row($oResult);
				$this->oUsuario->setLogin($aRow[0]);
				$this->oUsuario->setNivelPermiso($aRow[1]);
				$bExist = true;	
			}
			mysql_free_result($oResult);
				
			return $bExist;
		}
		
		public function getNivelUsuario(){
			return $this->oUsuario->getNivelPermiso();
		}
	}
?>